const http = require('http');
const fs = require('fs');

http
  .createServer((req, res) => {
    const { url } = req;
    if (url === '/index') {
      const content = fs.readFileSync('index.html', { encoding: 'utf-8' });
      res.end(content);
    }
  })
  .listen(3000, () => {
    console.log('Server running at http://localhost:3000/');
  });
